<?php
namespace Product\Form;

use Zend\Form\Form;
use Zend\Form\Element;

class ProductForm extends Form
{
	public function __construct($name = null)
	{
		parent::__construct('product');
		$this->setAttributes(array(
				'method' => 'post',
				'enctype' => 'multipart/form-data',
		));
		$this->add(array(
				'name' => 'id',
				'attributes' => array(
						'type' => 'hidden',
				),
		));
		$this->add(array(
				'name' => 'name',
				'attributes' => array(
						'type' => 'text',
						'class' => 'form-control',
						'placeholder' => 'Product name...',
						'required' => 'required',
						'minlength' => 3,
				),
				'options' => array(
						'label' => 'Product name',
				),
		));
		$this->add(array(
				'name' => 'description',
				'attributes' => array(
						'type' => 'textarea',
						'class' => 'form-control',
						'cols' => '40',
						'rows' => '3',
						'placeholder' => 'Enter desciption for this product here'
				),
				'options' => array(
						'label' => 'Description',
				),
		));
		$this->add(array(
	   'name' => 'category',
	   'type' => 'MultiCheckbox',
	   'options' => array(
	   		'label' => 'Category',
	   ),
		));
		$this->add(array(
				'name' => 'manufacture',
				'attributes' => array(
						'type' => 'text',
						'class' => 'form-control',
						'placeholder' => 'Manufacture',
				),
				'options' => array(
						'label' => 'Manufacture',
				),
		));
		$this->add(array(
				'name' => 'alias',
				'attributes' => array(
						'type' => 'text',
						'class' => 'form-control',
						'placeholder' => 'Alias',
				),
				'options' => array(
						'label' => 'Alias'
				),
		));
		$this->add(array(
				'name' => 'preview_img',
				'attributes' => array(
						'type' => 'file',
				),
				'options' => array(
						'label' => 'Choice image preview',
				),
		));
		$this->add(array(
				'name' => 'price',
				'attributes' => array(
						'type' => 'text',
						'class' => 'form-control',
						'placeholder' => 'Enter number',
				),
				'options' => array(
						'label' => 'Price',
				),
		));
		$this->add(array(
				'name' => 'disabled',
				'type' => 'checkbox',
				'options' => array(
						'label' => 'Diasbled ',
						'labelAttributes' => array(
								'class' => 'error',
						),
						'checked_value' => 1,
						'unchecked_value' => 0,
				),
		));
		$this->add(array(
				'name' => 'submit',
				'attributes' => array(
						'type' => 'submit',
						'class' => 'btn btn-primary',
						'value' => 'Go',
				),
		));
	}
}